/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package py.com.peluq.model.entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Diego_M
 */
@Entity
@Table(name = "entidad_adherida", catalog = "peludb", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "EntidadAdherida.findAll", query = "SELECT e FROM EntidadAdherida e"),
    @NamedQuery(name = "EntidadAdherida.findByIdMarcas", query = "SELECT e FROM EntidadAdherida e WHERE e.idMarcas = :idMarcas")})
public class EntidadAdherida implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "idMarcas", nullable = false)
    private Integer idMarcas;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "entidadadheridaidMarcas")
    private Collection<DetTarjetas> detTarjetasCollection;
    @JoinColumn(name = "ent_emisora_cod", referencedColumnName = "ent_emisora_cod", nullable = false)
    @ManyToOne(optional = false)
    private EntidadEmisora entEmisoraCod;
    @JoinColumn(name = "idMarcas", referencedColumnName = "idMarcas", nullable = false, insertable = false, updatable = false)
    @OneToOne(optional = false)
    private Marcas marcas;

    public EntidadAdherida() {
    }

    public EntidadAdherida(Integer idMarcas) {
        this.idMarcas = idMarcas;
    }

    public Integer getIdMarcas() {
        return idMarcas;
    }

    public void setIdMarcas(Integer idMarcas) {
        this.idMarcas = idMarcas;
    }

    @XmlTransient
    public Collection<DetTarjetas> getDetTarjetasCollection() {
        return detTarjetasCollection;
    }

    public void setDetTarjetasCollection(Collection<DetTarjetas> detTarjetasCollection) {
        this.detTarjetasCollection = detTarjetasCollection;
    }

    public EntidadEmisora getEntEmisoraCod() {
        return entEmisoraCod;
    }

    public void setEntEmisoraCod(EntidadEmisora entEmisoraCod) {
        this.entEmisoraCod = entEmisoraCod;
    }

    public Marcas getMarcas() {
        return marcas;
    }

    public void setMarcas(Marcas marcas) {
        this.marcas = marcas;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idMarcas != null ? idMarcas.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof EntidadAdherida)) {
            return false;
        }
        EntidadAdherida other = (EntidadAdherida) object;
        if ((this.idMarcas == null && other.idMarcas != null) || (this.idMarcas != null && !this.idMarcas.equals(other.idMarcas))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "py.com.peluq.model.entity.EntidadAdherida[ idMarcas=" + idMarcas + " ]";
    }
    
}
